﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Runda.CMS.Bll;
using System.Xml;
using Runda.CMS.Common.Utility;

namespace Runda.CMS.Portal.ContractManage
{
    public partial class ContractSetting : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                XmlDocument document = new XmlDocument();
                string xml = "<params></params>";
                document.LoadXml(xml);

                XmlElement element = document.CreateElement("group");

                element = document.CreateElement("group");
                element.SetAttributeNode("name", "").Value = "合同管理";
                document.DocumentElement.AppendChild(element);
               
                XmlElement newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "contractRatio";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "合同利润";
                newChild.SetAttributeNode("Description", "").Value = "合同签约须满足的最小利润比例";
                newChild.SetAttributeNode("Url", "").Value = "/ContractManage/ContractSetting_config.aspx?type=" + System.Convert.ToInt32(ContractEnumerator.ContractParms.contractRatio).ToString();

                element.AppendChild(newChild);

                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "contractAttr";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "合同属性";
                newChild.SetAttributeNode("Description", "").Value = "合同属性信息";
                newChild.SetAttributeNode("Url", "").Value = "/ContractManage/ContractSetting_config.aspx?type=" + System.Convert.ToInt32(ContractEnumerator.ContractParms.contractAttr).ToString();
                element.AppendChild(newChild);              

                element = document.CreateElement("group");
                element.SetAttributeNode("name", "").Value = "财务收款管理";
                document.DocumentElement.AppendChild(element);
            
                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "MonthRate";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "月系数";
                newChild.SetAttributeNode("Description", "").Value = "月完成收账的比率";
                newChild.SetAttributeNode("Url", "").Value = "/Finiance/FinianceAccountsReceivable_config.aspx?type=" + System.Convert.ToInt32(ContractEnumerator.FinianceAccountsReceivable.MonthRate).ToString();

                element.AppendChild(newChild);

                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "CheckOffsType";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "核销类型";
                newChild.SetAttributeNode("Description", "").Value = "业务员月收账情况核销类型";
                newChild.SetAttributeNode("Url", "").Value = "/Finiance/CheckOffsType_config.aspx?type=" + System.Convert.ToInt32(ContractEnumerator.FinianceAccountsReceivable.CheckOffsType).ToString();
                element.AppendChild(newChild);

                element = document.CreateElement("group");
                element.SetAttributeNode("name", "").Value = "器械维修保养";
                document.DocumentElement.AppendChild(element);

                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "InstrumentConservation";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "器械保养项";
                newChild.SetAttributeNode("Description", "").Value = "器械中需要保养的项目";
                newChild.SetAttributeNode("Url", "").Value = "/ContractFollowUp/InstrumentConservation_config.aspx";
                element.AppendChild(newChild);

                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "InstrumentConservation";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "节假日设定";
                newChild.SetAttributeNode("Description", "").Value = "设定每年中法定节日";
                newChild.SetAttributeNode("Url", "").Value = "/ContractFollowUp/Holiday_config.aspx";

                element.AppendChild(newChild); 

                element = document.CreateElement("group");
                element.SetAttributeNode("name", "").Value = "配件更换参数";
                document.DocumentElement.AppendChild(element);

                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "AccessorySource";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "配件来源属性";
                newChild.SetAttributeNode("Description", "").Value = "配件来源属性";
                newChild.SetAttributeNode("Url", "").Value = "/ContractFollowUp/AccessorySetting.aspx?type="+(int)Enumerator.DictionaryType.AccessorySource;
                element.AppendChild(newChild);


                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "AccessoryPaymentsObject";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "配件收费对象";
                newChild.SetAttributeNode("Description", "").Value = "配件收费对象";
                newChild.SetAttributeNode("Url", "").Value = "/ContractFollowUp/AccessorySetting.aspx?type=" + (int)Enumerator.DictionaryType.AccessoryPaymentsObject;
                element.AppendChild(newChild);

                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "AccessoryPaymentType";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "配件收费类型";
                newChild.SetAttributeNode("Description", "").Value = "配件收费类型";
                newChild.SetAttributeNode("Url", "").Value = "/ContractFollowUp/AccessorySetting.aspx?type=" + (int)Enumerator.DictionaryType.AccessoryPaymentType;
                element.AppendChild(newChild);

                newChild = document.CreateElement("param");
                newChild.SetAttributeNode("ParamName", "").Value = "InstrumentConservation";
                newChild.SetAttributeNode("ParamNameChn", "").Value = "服务单回访项";
                newChild.SetAttributeNode("Description", "").Value = "服务回访后进行评定的项目";
                newChild.SetAttributeNode("Url", "").Value = "/ContractFollowUp/BillEvaluation_config.aspx";

                element.AppendChild(newChild);

          

                xml = document.DocumentElement.OuterXml;
                this.txtXML.Text = xml;
            }
        }
    }
}
